package org.hhchat.leetcode.math;

/**
 * Created by HMH on 2017/3/29.
 */

/**
 * AC
 */
public class code171 {
    public int titleToNumber(String s) {
        char[] chars = s.toCharArray();
        int len = chars.length;
        int sum=0;
        for(int i=0;i<len;i++) {
            sum*=26;
            sum += chars[i] - 'A'+1;
        }
        return sum;

    }

    public static void main(String[] args){
        System.out.println(new code171().titleToNumber("AZ"));
    }
}
